layui.define(function(exports) {
    var idCardUitl = {
        getBirthday: function(idCard) {
            return idCard.substring(6, 10) + '-' + idCard.substring(10, 12) + '-' + idCard.substring(12, 14);
        },
        getAge: function(idCard) {
            let date = new Date();
            let age = date.getFullYear() - idCard.substring(6, 10) - 1;
            let month = date.getMonth() + 1;
            if (idCard.substring(10, 12) < month || idCard.substring(10, 12) == month && idCard.substring(10, 12) <= date.getDate()) {
                age++;
            }
            return age;
        },
        getGender: function(idCard) {
            return idCard.substr(16, 1) % 2 == 1 ? 1 : 0;
        },
    };
    //注意，这里是模块输出的核心，模块名必须和use时的模块名一致
    exports('tools', {});
});